<template>
  <div class="modal fade" ref="modfuncdiv" id="modfuncdiv">
    <div class="modal-dialog modal-dialog-centered" :class="[vdata.onpc?'modal-lg':'']">
      <!-- <div class="modal-content" style="background:DarkSlateGray">
        <div class="modal-header">
          <h4 class="modal-title">模态框头部</h4>
          <button type="button" class="close" data-dismiss="modal">&times;</button>
        </div>
        <div class="modal-body">
          <chat ref="chat" v-show="vdata.modfuncname == 'chat'"></chat>
          <offline ref="offline" v-show="vdata.modfuncname == 'offline'"></offline>
          <fly ref="fly" v-show="vdata.modfuncname == 'fly'"></fly>
          <score ref="score" v-show="vdata.modfuncname == 'score'"></score>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
        </div>
      </div> -->
      <div class="modal-content container-fluid m-0 p-1" style="background:DarkOliveGreen">
        <!-- <button type="button" v-show="vdata.modfuncname == 'skills'" class="btn btn-secondary" data-dismiss="modal">关闭</button> -->

        <jxdebug ref="jxdebug" v-show="vdata.modfuncname == 'debug'"></jxdebug>
        <chat ref="chat" v-show="vdata.modfuncname == 'chat'"></chat>
        <offline ref="offline" v-show="vdata.modfuncname == 'offline'"></offline>
        <fly ref="fly" v-show="vdata.modfuncname == 'fly'"></fly>
        <score ref="score" v-show="vdata.modfuncname == 'score'"></score>
        <skills ref="skills" v-show="vdata.modfuncname == 'skills'"></skills>
        <inv ref="inv" v-show="vdata.modfuncname == 'inv'"></inv>
      </div>
    </div>
  </div>
</template>

<script>
/* eslint-disable comma-dangle */

import jxdebug from './modfunc/Debug.vue'
import chat from './modfunc/Chat.vue'
import offline from './modfunc/Offline.vue'
import fly from './modfunc/Fly.vue'
import score from './modfunc/Score.vue'
import skills from './modfunc/Skills.vue'
import inv from './modfunc/Inv.vue'

export default {
  data: function () {
    return {
      vdata: this.gdata.data
    }
  },
  components: {
    jxdebug: jxdebug,
    chat: chat,
    offline: offline,
    fly: fly,
    score: score,
    skills: skills,
    inv: inv,
  },
  methods: {
    vdom: function () {
      // eslint-disable-next-line no-undef
      return $('#modfuncdiv')
    },
    vshow: function () {
      this.vdom().modal('show')
    },
    vclose: function () {
      this.vdom().modal('hide')
    },
    isshow: function () {
      return this.vdom().css('display') === 'block'
    },
    onkeyevent: function (key) {
      if (!this.isshow()) { return }
      switch (this.vdata.modfuncname) {
        case 'chat':
          this.$refs.chat.onkeyevent(key)
          break
        default: break
      }
    }
  }
}
</script>

<style scoped>
</style>
